#include"UdpServer.hpp"
#include<memory>
#include"Route.hpp"
// server端从命令行参数获取server端的ip和端口
int main(int argc, char *argv[])
{
    EnableScreen();
    if (argc != 2)
    {
        std::cout << "输入参数个数太少" << std::endl;
        exit(0);
    }
    // 获取server端
    //不需要输入ip,因为云服务器的ip适合写为0
    uint16_t serverport = std::stoi(argv[1]);
    Route messageroute;
    //绑定转发函数
    service_t service_route = std::bind(&Route::Forward,&messageroute,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3);
    std::unique_ptr<UdpServer> usvr = std::make_unique<UdpServer>(serverport,service_route);//智能指针
    usvr->Init();
    usvr->Start();
    return 0;
}